using System;
using System.Collections.Generic;
using System.Data.Linq.Mapping;
using InfoTech.Core.Data.Attributes;
using InfoTech.Core.Data.Dataable;
using InfoTech.Core.Data.Persistence;
using InfoTech.Utilities.Generic;

namespace InfoTech.LanTranh.MucVu.Bussiness
{
	[Serializable]
	[ExtraTable(Name = "LINHMUC", Schema="dbo")]
	[Table(Name = "[dbo].[LINHMUC]")]
	public partial class LINHMUC : ObjPersistence, IDeleteable, IUpdateable, IInsertable, ISelectable, IDeleteablebyId, IUpdateablebyId, ISelectablebyId
	{

		#region Fields

		private System.Guid _machaxu;

		private System.String _tenthanh;

		private System.String _hovatendem;

		private System.String _ten;

		private System.String _dienthoai;

		private System.String _diachi;

		private System.String _email;

		private System.String _mobile;

		private System.Guid? _machucvu;

		private System.Int32? _ngaysinh;

		private System.Int32? _thangsinh;

		private System.Int32? _namsinh;

		private IEnumerable<SOBITICH> _ref_sobitich;

		private IEnumerable<SOHONNHAN> _ref_sohonnhan;

		private IEnumerable<SOXUCDAU> _ref_soxucdau;

		private IEnumerable<GIAOHAT> _ref_giaohat;

		private IEnumerable<GIAOPHAN> _ref_giaophan;

		private IEnumerable<GIAOXU> _ref_giaoxu;

		private LINHMUC_CHUCVU _prt_linhmuc_chucvu;

		#endregion

		#region Properties

		[ExtraColumn(DbType = "uniqueidentifier", Length = 0, TypeName = "System.Guid", Type = typeof(System.Guid), CanBeNull = false)]
		[Column(Name = "MACHAXU", DbType = "uniqueidentifier", IsPrimaryKey = true, CanBeNull = false)]
		public System.Guid MACHAXU
		{
			get
			{
				return _machaxu;
			}
			set
			{
				OnChanged(this, "MACHAXU");
				_machaxu = value;
			}
		}

		[ExtraColumn(DbType = "nvarchar", Length = 500, TypeName = "System.String", Type = typeof(System.String), CanBeNull = true)]
		[Column(Name = "TENTHANH", DbType = "nvarchar(500)", IsPrimaryKey = false, CanBeNull = true)]
		public System.String TENTHANH
		{
			get
			{
				return _tenthanh;
			}
			set
			{
				OnChanged(this, "TENTHANH");
				_tenthanh = value;
			}
		}

		[ExtraColumn(DbType = "nvarchar", Length = 500, TypeName = "System.String", Type = typeof(System.String), CanBeNull = true)]
		[Column(Name = "HOVATENDEM", DbType = "nvarchar(500)", IsPrimaryKey = false, CanBeNull = true)]
		public System.String HOVATENDEM
		{
			get
			{
				return _hovatendem;
			}
			set
			{
				OnChanged(this, "HOVATENDEM");
				_hovatendem = value;
			}
		}

		[ExtraColumn(DbType = "nvarchar", Length = 100, TypeName = "System.String", Type = typeof(System.String), CanBeNull = true)]
		[Column(Name = "TEN", DbType = "nvarchar(100)", IsPrimaryKey = false, CanBeNull = true)]
		public System.String TEN
		{
			get
			{
				return _ten;
			}
			set
			{
				OnChanged(this, "TEN");
				_ten = value;
			}
		}

		[ExtraColumn(DbType = "nvarchar", Length = 20, TypeName = "System.String", Type = typeof(System.String), CanBeNull = true)]
		[Column(Name = "DIENTHOAI", DbType = "nvarchar(20)", IsPrimaryKey = false, CanBeNull = true)]
		public System.String DIENTHOAI
		{
			get
			{
				return _dienthoai;
			}
			set
			{
				OnChanged(this, "DIENTHOAI");
				_dienthoai = value;
			}
		}

		[ExtraColumn(DbType = "nvarchar", Length = 1000, TypeName = "System.String", Type = typeof(System.String), CanBeNull = true)]
		[Column(Name = "DIACHI", DbType = "nvarchar(1000)", IsPrimaryKey = false, CanBeNull = true)]
		public System.String DIACHI
		{
			get
			{
				return _diachi;
			}
			set
			{
				OnChanged(this, "DIACHI");
				_diachi = value;
			}
		}

		[ExtraColumn(DbType = "nvarchar", Length = 1000, TypeName = "System.String", Type = typeof(System.String), CanBeNull = true)]
		[Column(Name = "EMAIL", DbType = "nvarchar(1000)", IsPrimaryKey = false, CanBeNull = true)]
		public System.String EMAIL
		{
			get
			{
				return _email;
			}
			set
			{
				OnChanged(this, "EMAIL");
				_email = value;
			}
		}

		[ExtraColumn(DbType = "nvarchar", Length = 20, TypeName = "System.String", Type = typeof(System.String), CanBeNull = true)]
		[Column(Name = "MOBILE", DbType = "nvarchar(20)", IsPrimaryKey = false, CanBeNull = true)]
		public System.String MOBILE
		{
			get
			{
				return _mobile;
			}
			set
			{
				OnChanged(this, "MOBILE");
				_mobile = value;
			}
		}

		[ExtraColumn(DbType = "uniqueidentifier", Length = 0, TypeName = "System.Guid", Type = typeof(System.Guid), CanBeNull = true)]
		[Column(Name = "MACHUCVU", DbType = "uniqueidentifier", IsPrimaryKey = false, CanBeNull = true)]
		public System.Guid? MACHUCVU
		{
			get
			{
				return _machucvu;
			}
			set
			{
				OnChanged(this, "MACHUCVU");
				_machucvu = value;
			}
		}

		[ExtraColumn(DbType = "int", Length = 0, TypeName = "System.Int32", Type = typeof(System.Int32), CanBeNull = true)]
		[Column(Name = "NGAYSINH", DbType = "int", IsPrimaryKey = false, CanBeNull = true)]
		public System.Int32? NGAYSINH
		{
			get
			{
				return _ngaysinh;
			}
			set
			{
				OnChanged(this, "NGAYSINH");
				_ngaysinh = value;
			}
		}

		[ExtraColumn(DbType = "int", Length = 0, TypeName = "System.Int32", Type = typeof(System.Int32), CanBeNull = true)]
		[Column(Name = "THANGSINH", DbType = "int", IsPrimaryKey = false, CanBeNull = true)]
		public System.Int32? THANGSINH
		{
			get
			{
				return _thangsinh;
			}
			set
			{
				OnChanged(this, "THANGSINH");
				_thangsinh = value;
			}
		}

		[ExtraColumn(DbType = "int", Length = 0, TypeName = "System.Int32", Type = typeof(System.Int32), CanBeNull = true)]
		[Column(Name = "NAMSINH", DbType = "int", IsPrimaryKey = false, CanBeNull = true)]
		public System.Int32? NAMSINH
		{
			get
			{
				return _namsinh;
			}
			set
			{
				OnChanged(this, "NAMSINH");
				_namsinh = value;
			}
		}

		public IEnumerable<SOBITICH> REF_SOBITICH
		{
			get
			{
				if (RefreshType == InfoTech.Core.Data.RefreshType.Allway || (RefreshType == InfoTech.Core.Data.RefreshType.OnlyonNull && _ref_sobitich == null))
					InfoTech.Core.Data.Receiver.TypeObject<SOBITICH>.Select(this, "REF_SOBITICH", new[] { new Vector<string, string>("MACHAXU", "MALINHMUC"), }, InfoTech.Core.Data.RelationType.OnetoMany);
				return _ref_sobitich;
			}
			set
			{
				_ref_sobitich = value;
			}
		}

		public IEnumerable<SOHONNHAN> REF_SOHONNHAN
		{
			get
			{
				if (RefreshType == InfoTech.Core.Data.RefreshType.Allway || (RefreshType == InfoTech.Core.Data.RefreshType.OnlyonNull && _ref_sohonnhan == null))
					InfoTech.Core.Data.Receiver.TypeObject<SOHONNHAN>.Select(this, "REF_SOHONNHAN", new[] { new Vector<string, string>("MACHAXU", "MALINHMUC"), }, InfoTech.Core.Data.RelationType.OnetoMany);
				return _ref_sohonnhan;
			}
			set
			{
				_ref_sohonnhan = value;
			}
		}

		public IEnumerable<SOXUCDAU> REF_SOXUCDAU
		{
			get
			{
				if (RefreshType == InfoTech.Core.Data.RefreshType.Allway || (RefreshType == InfoTech.Core.Data.RefreshType.OnlyonNull && _ref_soxucdau == null))
					InfoTech.Core.Data.Receiver.TypeObject<SOXUCDAU>.Select(this, "REF_SOXUCDAU", new[] { new Vector<string, string>("MACHAXU", "MALINHMUC"), }, InfoTech.Core.Data.RelationType.OnetoMany);
				return _ref_soxucdau;
			}
			set
			{
				_ref_soxucdau = value;
			}
		}

		public IEnumerable<GIAOHAT> REF_GIAOHAT
		{
			get
			{
				if (RefreshType == InfoTech.Core.Data.RefreshType.Allway || (RefreshType == InfoTech.Core.Data.RefreshType.OnlyonNull && _ref_giaohat == null))
					InfoTech.Core.Data.Receiver.TypeObject<GIAOHAT>.Select(this, "REF_GIAOHAT", new[] { new Vector<string, string>("MACHAXU", "MACHAXU"), }, InfoTech.Core.Data.RelationType.OnetoMany);
				return _ref_giaohat;
			}
			set
			{
				_ref_giaohat = value;
			}
		}

		public IEnumerable<GIAOPHAN> REF_GIAOPHAN
		{
			get
			{
				if (RefreshType == InfoTech.Core.Data.RefreshType.Allway || (RefreshType == InfoTech.Core.Data.RefreshType.OnlyonNull && _ref_giaophan == null))
					InfoTech.Core.Data.Receiver.TypeObject<GIAOPHAN>.Select(this, "REF_GIAOPHAN", new[] { new Vector<string, string>("MACHAXU", "MACHAXU"), }, InfoTech.Core.Data.RelationType.OnetoMany);
				return _ref_giaophan;
			}
			set
			{
				_ref_giaophan = value;
			}
		}

		public IEnumerable<GIAOXU> REF_GIAOXU
		{
			get
			{
				if (RefreshType == InfoTech.Core.Data.RefreshType.Allway || (RefreshType == InfoTech.Core.Data.RefreshType.OnlyonNull && _ref_giaoxu == null))
					InfoTech.Core.Data.Receiver.TypeObject<GIAOXU>.Select(this, "REF_GIAOXU", new[] { new Vector<string, string>("MACHAXU", "MACHAXU"), }, InfoTech.Core.Data.RelationType.OnetoMany);
				return _ref_giaoxu;
			}
			set
			{
				_ref_giaoxu = value;
			}
		}

		public LINHMUC_CHUCVU PRT_LINHMUC_CHUCVU
		{
			get
			{
				if (RefreshType == InfoTech.Core.Data.RefreshType.Allway || (RefreshType == InfoTech.Core.Data.RefreshType.OnlyonNull && _prt_linhmuc_chucvu == default(LINHMUC_CHUCVU)))
					InfoTech.Core.Data.Receiver.TypeObject<LINHMUC_CHUCVU>.Select(this, "PRT_LINHMUC_CHUCVU", new[] { new Vector<string, string>("MACHUCVU", "MACHUCVU"), }, InfoTech.Core.Data.RelationType.OnetoOne);
				return _prt_linhmuc_chucvu;
			}
			set
			{
				_prt_linhmuc_chucvu = value;
			}
		}

		#endregion

		#region Reflector

		public System.Type Reflector()
		{
			return typeof(LINHMUC);
		}
		public object Current
		{
			get { return this; }
		}

		#endregion

	}
}
